<template>
  <el-form :inline="true" v-model="formData" class="demo-form-inline">
    <el-form-item label="销售ID"><el-input v-model="formData.saleId" placeholder="销售ID"></el-input></el-form-item>
    <el-form-item label="顾客姓名"><el-input v-model="formData.customerName" placeholder="顾客姓名"></el-input></el-form-item>
    <el-form-item label="销售门店">
      <el-select v-model="formData.deptId" placeholder="请选择">
        <el-option label="视光中心" value="sgzx"></el-option>
        <el-option label="人民医院检验中心" value="rmyy-jyzx"></el-option>
      </el-select>
    </el-form-item>
    <el-form-item><el-button type="primary" @click="dataFormSubmit" v-prevent-re-click>查询</el-button></el-form-item>
  </el-form>
</template>

<script>
export default {
  data() {
    return {
      formData: {
        saleId: '',
        customerName: '',
        deptId: ''
      }
    };
  },
  methods: {
    dataFormSubmit() {
      this.$refs['dataForm'].validate(valid => {
        if (valid) {
          if (this.dataForm.saleId) {
            workCheckPutObj(this.dataForm).then(response => {
              if(response.data.code == '0'){
                this.$message.success('修改成功')
                this.visible = false
                this.$emit('refreshDataList')
              }else{
                this.$message.error(response.data.msg)
              }
            })
          } else {
            workCheckAddObj(this.dataForm).then(response => {
              if(response.data.code == '0'){
                this.$message.success('添加成功')
                this.visible = false
                this.$emit('refreshDataList')
              }else{
                this.$message.error(response.data.msg)
              }
            })
          }
        }
      });
    }
  },
  computed: {
  }
};
</script>

<style></style>
